<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html>

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>个人注册</title>
	<link rel="icon" href="./img/favicon.ico">


    <link rel="stylesheet" type="text/css" href="./css/all.css" />
    <link rel="stylesheet" type="text/css" href="./css/pages-register.css" />
</head>

<body>
	<!--页面顶部-->
<div id="nav-bottom">
	<!--顶部-->
	<div class="nav-top">
		<div class="top">
			<div class="py-container">
				<div class="shortcut">
					<ul class="fl">
						<li class="f-item">尚品汇欢迎您！</li>
						<li class="f-item">请<a href="login.html" target="_blank">登录</a>　<span><a href="register.html" target="_blank">免费注册</a></span></li>
					</ul>
					<div class="fr typelist">
						<ul class="types">
							<li class="f-item"><span>我的订单</span></li>

							<li class="f-item"><span><a href="cart.html" target="_blank">我的购物车</a></span></li>
							<li class="f-item"><span><a href="home.html" target="_blank">我的尚品汇</a></span></li>
							<li class="f-item"><span>尚品汇会员</span></li>
							<li class="f-item"><span>企业采购</span></li>
							<li class="f-item"><span>关注尚品汇</span></li>
							<li class="f-item"><span><a href="cooperation.html" target="_blank">合作招商</a></span></li>
							<li class="f-item"><span><a href="shoplogin.html" target="_blank">商家后台</a></span></li>
						</ul>
					</div>

				</div>
			</div>
		</div>

		<!--头部-->
		<div class="header">
			<div class="py-container">
				<div class="yui3-g Logo">
					<div class="yui3-u Left logoArea">
						<a class="logo-bd" title="尚品汇" href="index.html" target="_blank"></a>
					</div>
					<div class="yui3-u Rit searchArea">
						<div class="search">
							<form action="" class="sui-form form-inline">
								<!--searchAutoComplete-->
								<div class="input-append">
									<input type="text" id="autocomplete"  class="input-error input-xxlarge" />
									<button class="sui-btn btn-xlarge btn-danger" type="button">搜索</button>
								</div>
							</form>
						</div>
					</div>

				</div>

			</div>
		</div>
	</div>
</div>

	<div class="register py-container ">

		<!--register-->
		<div class="registerArea">
			<h3>注册新用户<span class="go">我有账号，去<a href="login.html" target="_blank">登陆</a></span></h3>
			<div class="info">
				<form class="sui-form form-horizontal">
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputLoginName" type="password" v-model="user.loginName" placeholder="请输入用户名" class="span2 input-xfat">
					</div>
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputNickName" type="password" v-model="user.nickName" placeholder="请输入别名" class="span2 input-xfat">
					</div>
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputPasswd" type="password" v-model="user.passwd" placeholder="请输入密码" class="span2 input-xfat">
					</div>
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputPassword" type="password" v-model="user.passwd2" placeholder="请确认密码" class="span2 input-xfat">
					</div>
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputRealName" type="password" v-model="user.realName" placeholder="请输入真实姓名" class="span2 input-xfat">
					</div>
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputPhoneNumber" type="password" v-model="user.phoneNumber" placeholder="请输入手机号" class="span2 input-xfat">
					</div>
					<div class="input-prepend"><span class="add-on loginpwd"></span>
						<input id="inputEmail" type="password" v-model="user.email" placeholder="请输入邮箱" class="span2 input-xfat">
					</div>
					<!--<div class="control-group">
						<label class="control-label">用户名：</label>
						<div class="controls">
							<input type="text" placeholder="请输入你的用户名" class="input-xfat input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">真实姓名：</label>
						<div class="controls">
							<input type="text" placeholder="请输入你的真实姓名" class="input-xfat input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">手机号：</label>
						<div class="controls">
							<input type="text" placeholder="请输入你的手机号" class="input-xfat input-xlarge">
						</div>
					</div>
					&lt;!&ndash;<div class="control-group">
						<label for="inputPassword" class="control-label">验证码：</label>
						<div class="controls">
							<input type="text" placeholder="验证码" class="input-xfat input-xlarge">
						</div>
					</div>&ndash;&gt;
					<div class="control-group">
						<label for="inputPassword" class="control-label">登录密码：</label>
						<div class="controls">
							<input type="password" placeholder="设置登录密码" class="input-xfat input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label for="inputPassword" class="control-label">确认密码：</label>
						<div class="controls">
							<input type="password" placeholder="再次确认密码" class="input-xfat input-xlarge">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">邮件：</label>
						<div class="controls">
							<input type="text" placeholder="请输入你的邮件地址" class="input-xfat input-xlarge">
						</div>
					</div>
-->
					<div class="control-group">
						<label for="inputPassword" class="control-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
						<div class="controls">
							<input name="m1" type="checkbox" value="2" checked=""><span>同意协议并注册《尚品汇用户协议》</span>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label"></label>
						<div class="controls btn-reg">

							<a class="sui-btn btn-block btn-xlarge btn-danger" href="javascript:" target="_blank" @click="register()">完成注册</a>
						</div>
					</div>
				</form>
				<div class="clearfix"></div>
			</div>
		</div>
		<!--foot-->
		<div class="py-container copyright">
			<ul>
				<li>关于我们</li>
				<li>联系我们</li>
				<li>联系客服</li>
				<li>商家入驻</li>
				<li>营销中心</li>
				<li>手机尚品汇</li>
				<li>销售联盟</li>
				<li>尚品汇社区</li>
			</ul>
			<div class="address">地址：北京市昌平区宏福科技园综合楼6层</div>
			<div class="beian">京ICP备19006430号
			</div>
		</div>
	</div>

<script src="/js/api/register.js"></script>
<script th:inline="javascript">
		var item = new Vue({
			el: '#profile',

			data: {
				originUrl: [[${originUrl}]],
				user: {
					loginName: '',
					passwd: '',
					nickName:'',
					passwd2:'',
					phoneNumber:'',
					email:'',
					realNumber:''
				}
			},

			created() {
			},

			methods: {
				register(){
					register.register(this.user).then(response => {
						if (response.data.code == 200) {
							if(this.originUrl == ''){
								window.location.href="http://www.gmall.com"
								return ;
							} else {
								window.location.href = decodeURIComponent(this.originUrl)
							}
					    }else {
						alert(response.data.data.message)
					    }

				})
				}
			}
		})
	</script>

</body>

</html>
